import { fileURLToPath, URL } from 'node:url'

import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig } from 'vite'

// https://vite.dev/config/
export default defineConfig({
  optimizeDeps: {
    include: ['@tsparticles/vue3', 'tsparticles-slim'],
  },
  plugins: [
    vue(),
    vueJsx(),
    UnoCSS(),
    AutoImport({
      vueTemplate: true,
      include: [/\.[tj]sx?$/, /\.vue?$/, /\.md$/],
      imports: ['vue', 'vue-router', { '@/utils/autoImport': ['dayjs', 'httpRequest', 'message', 'Modal'] }],
      eslintrc: {
        enabled: false,
        filepath: './.eslintrc-auto-import.json',
        globalsPropValue: true,
      },
      resolvers: [],
      dts: './auto-import.d.ts',
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  server: {
    // 端口
    port: 3000,
    // 代理
  },
})
